package com.kla.power.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.kla.power.entity.InverterDcAmountEntity;
import com.kla.power.mapper.InverterDcAmountMapper;
import com.kla.power.service.IInverterDcAmountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 直流电 服务实现类
 * </p>
 *
 * @author WuZH
 * @since 2024-06-10
 */
@Service
public class InverterDcAmountServiceImpl extends ServiceImpl<InverterDcAmountMapper, InverterDcAmountEntity> implements IInverterDcAmountService {

    @Override
    public List<InverterDcAmountEntity> queryList ( InverterDcAmountEntity inverterDcAmountEntity ) {
        LambdaQueryWrapper<InverterDcAmountEntity> lambdaQueryWrapper = new LambdaQueryWrapper<> ();
        if ( StringUtils.isNotBlank ( inverterDcAmountEntity.getInverterSystemId () ) ) {
            lambdaQueryWrapper.eq ( InverterDcAmountEntity :: getInverterSystemId, inverterDcAmountEntity.getInverterSystemId () );
        }
        if ( StringUtils.isNotBlank ( inverterDcAmountEntity.getInverterSn () ) ) {
            lambdaQueryWrapper.eq ( InverterDcAmountEntity :: getInverterSn, inverterDcAmountEntity.getInverterSn () );
        }
        List<InverterDcAmountEntity> list = this.list ( lambdaQueryWrapper );
        return list;
    }


    @Resource
    private InverterDcAmountMapper inverterDcAmountMapper;

    @Override
    public List<InverterDcAmountEntity> queryHistoryData (InverterDcAmountEntity inverterDcAmountEntity) {
        List<InverterDcAmountEntity> inverterDcAmountEntities = inverterDcAmountMapper.queryHistoryData ( inverterDcAmountEntity );
        return inverterDcAmountEntities;
    }

}
